package com.ruoyi.lzxt.user.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.lzxt.user.domain.entity.Employee;
import com.ruoyi.lzxt.user.mapper.EmployeeMapper;
import com.ruoyi.lzxt.user.service.EmployeeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Service
@DS("slave") // 切换从库查询
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {


    public Employee selectUserByUserName(String userName) {
        // 查询用户
        LambdaQueryWrapper<Employee> qw = new LambdaQueryWrapper<>();
        qw.eq(Employee::getUserId,userName);
        System.out.println(userName+":userName");
        return this.getOne(qw);
    }
}
